{* Smarty *}
{*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-07-02 22:13:40 +0200 (Wed, 02 Jul 2008) $
 * $Rev: 1259 $
 * $Author: styck $
 * $Id: ajax_showstatus.tpl 1259 2008-07-02 20:13:40Z styck $
 *}
{* Ajax page, doesn't need a head/foot tpl *}
{* Window resize button at top right: *}
{strip}
<div id="statussize">
<img src="{$IMGDIR}/icon_windowsize.png" alt="" onclick="javascript:ToggleStatusWindow();"/>
</div>

<div id="status">
{* Status overview: *}
{* Only show this if we have an URDD connection: (don't know it otherwise) *}
{if $isconnected}
<h3>{$LN_activity}:</h3>
{if $counter <= $taskmax2}
{* Check if there are any tasks: *}
{assign var="anytask" value=0}
{section name=x loop=$tasks}

{$tasks[x].name}
{if $tasks[x].counter > 1} (x{$tasks[x].counter}){/if} :<br/>
{$tasks[x].target|escape:htmlall}<br/>
{if $counter <= $taskmax1}
<table class="compact wide">
<tr><td class="harddisk" rowspan="2"><img src="{$IMGDIR}/actions/{$tasks[x].type}.png" alt="{$tasks[x].name|escape:htmlall}" height="24" width="24"/></td>
<td>
{if $tasks[x].progress <> -1}
{* Show progress bar: *}
	{assign var="progress" value=$tasks[x].progress}
	<img src="{$IMGDIR}/left.png" height="10" width="2" alt="left"/>
	<img src="{$IMGDIR}/light.png" height="10" width="{$progress}" alt="progressbar" {popup text="$progress %" }/>
	<img src="{$IMGDIR}/dark.png" height="10" width="{math equation="100 - a" a=$progress}" alt="progressbar" {popup text="$progress %" }/>
	<img src="{$IMGDIR}/right.png" height="10" width="2" alt="right"/>
{/if}
</td></tr>
<tr><td>
{if $tasks[x].niceeta <> -1}
    {* Show ETA: *}
    {$LN_eta}: {$tasks[x].niceeta|escape:htmlall} 
{/if}
</td></tr>
</table>
{/if}

<br/>
{assign var="anytask" value=1}
{/section}
{else}
<a href="admin_tasks.php"><b>{$LN_statusrunningtasks}: {$counter}</b></a>
{assign var="anytask" value=1}
{/if}


{* No tasks? Idling: *}
{if !$anytask}
{$LN_statusidling}!<br/>
{/if}        

{/if}
<h3>{$LN_tasks_status}:</h3>
{* URDD status: *}
{if $isadmin}
	{if $isconnected}
	<img src="{$IMGDIR}/light_green.png" onclick="javascript:AdminCommands('shutdown');" class="buttonlike" {popup text=$LN_disableurdd} alt="Urdd enabled" height="16" width="16"/>
    <span onclick="javascript:AdminCommands('shutdown');" class="buttonlike" {popup text=$LN_disableurdd}>{$LN_urddenabled}</span>
	{else}
{if ($startup_perc > 0) && ($startup_perc <= 99) }  
	<img src="{$IMGDIR}/light_yellow.png" alt="Urdd disabled" height="16" width="16"/>{$LN_urddstarting} {$startup_perc}% 
{else}
	<img src="{$IMGDIR}/light_red.png" onclick="javascript:AdminCommands('poweron');" class="buttonlike" {popup text=$LN_enableurdd} alt="Urdd disabled" height="16" width="16"/>
	<span onclick="javascript:AdminCommands('poweron');" class="buttonlike" {popup text=$LN_enableurdd}>{$LN_urdddisabled}</span>
{/if}
	{/if}
{else}
	{if $isconnected}
	<img src="{$IMGDIR}/light_green.png" alt="Urdd enabled" height="16" width="16"/>{$LN_urddenabled} 
	{else}
{if ($startup_perc > 0) && ($startup_perc <= 99) } 
	<img src="{$IMGDIR}/light_yellow.png" alt="Urdd disabled" height="16" width="16"/>{$LN_urddstarting} {$startup_perc}% 
{else}
	<img src="{$IMGDIR}/light_red.png" alt="Urdd disabled" height="16" width="16"/>{$LN_urdddisabled} 
{/if}
	{/if}
{/if}
<br/>

{* Version status: *}
{if $versionchecking}
	{assign var="updateimg" value="$IMGDIR/light_green.png"}

	{if $status_newversion}	{assign var="umessage" value=$LN_newversionavailable}	{assign var="updateimg" value="$IMGDIR/light_yellow.png"}{/if}
	{if $status_bugfix}	{assign var="umessage" value=$LN_bugfixedversion}	{assign var="updateimg" value="$IMGDIR/light_yellow.png"}{/if}
	{if $status_newfeature}	{assign var="umessage" value=$LN_newfeatureversion}	{assign var="updateimg" value="$IMGDIR/light_yellow.png"}{/if}
	{if $status_other}	{assign var="umessage" value=$LN_otherversion}		{assign var="updateimg" value="$IMGDIR/light_red.png"}{/if}
	{if $status_security}	{assign var="umessage" value=$LN_securityfixavailable}	{assign var="updateimg" value="$IMGDIR/light_red.png"}{/if}

	{if $updateimg == "$IMGDIR/light_green.png"}
        <img class="noborder" src="{$updateimg}" alt="Update"/>{$LN_versionuptodate} <br/>
	{else}
        <a href="{$URDDOWNLOADURL}"><img class="noborder" src="{$updateimg}" alt="Update" />
	<span {popup text="$LN_version $newversionnumber $LN_isavailable: $umessage"}/>{$LN_versionoutdated}</a>
	{/if}
{/if}

{if $isconnected}
<br/>
{* Disk usage: *}
<table class="compact wide">
<tr>
<td class="harddisk" rowspan="2"><img src="{$IMGDIR}/actions/harddisk.png" alt="{$LN_freediskspace}" height="24" width="24"/></td><td>
<img src="{$IMGDIR}/left.png" height="12" width="2" alt="left"/>
<img src="{$IMGDIR}/darkred.png" height="12" width="{$nodisk_perc}" alt="used diskspace" {popup text="$nodisk_perc% $LN_inuse"}/>
<img src="{$IMGDIR}/grey.png" height="12" width="2" alt="middle"/>
<img src="{$IMGDIR}/light.png" height="12" width="{$disk_perc}" alt="free diskspace" {popup text="$disk_perc% $LN_free"}/>
<img src="{$IMGDIR}/right.png" height="12" width="2" alt="right"/>
</td>
</tr>
<tr>
<td class="{if $disk_perc < 10}warning_highlight{/if}">({$disk_perc}% - {$diskfree})</td></tr>
</table>

{/if}
</div>

<br/>
{* URD version: *}
<div class="xxsmall"><a href="http://www.urdland.com/">URD {$LN_version|lower} {$URD_VERSION}</a></div>
{include file="ajax_foot.tpl"}
<div><input type="hidden" name="challenge" id="challenge_status" value="{$challenge}"/></div>
{/strip}
